#!/usr/local/bin/python

# example usage - ./test.py *.wav or python test.py *.wav

from pycdp import *

if __name__ == "__main__":  # python convention, but i think you can leave it out...
    mono  = cdp.housekeep.chans(4)
    norm  = cdp.modify.loudness(3)
    norm.l = 0.2

    pvocanal = cdp.pvoc.anal(1)
    #pvocanal.c = 128

    pvocsynth = cdp.pvoc.synth()

    stretch = cdp.stretch.time(1)
    stretch.timestretch = 4

    waver = cdp.strange.waver(1)
    waver.vibfrq = 20
    waver.stretch = 20
    waver.botfreq = 1000

    dv = cdp.envel.dovetail(2)
    dv.infadedur = 1024
    dv.outfadedur = 1024
    dv.t = 1 # set time unit to samples

    chain = []
    chain.append(mono)
    #chain.append(drunk)
    #chain.append(norm)
    chain.append(pvocanal)
    chain.append(stretch)
    chain.append(waver)
    chain.append(pvocsynth)
    #chain.append(drunk)
    chain.append(dv)

    output_files = cdp.run_chain(chain, sys.argv[1:], False)

    print(output_files) # debug!
